package com.ztgf.order.service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ztgf.order.common.config.YmlConfig;
import com.ztgf.order.mapper.OrderRepetitionPayMapper;
import com.ztgf.order.models.bo.OrderRepetitionPaySaveBO;
import com.ztgf.order.models.dto.OrderRepetitionPayDTO;
import com.ztgf.order.models.service.IOrderRepetitionPayService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;

import javax.annotation.Resource;

/**
 * 订单重复支付信息控制器
 *
 * @author YUE
 * @Date 2020-08-25 14:39:40
 */
@DubboService
public class OrderRepetitionPayServiceImpl extends ServiceImpl<OrderRepetitionPayMapper, OrderRepetitionPayDTO> implements IOrderRepetitionPayService{

    @Resource
    private YmlConfig ymlConfig;

    @Override
    public boolean add(OrderRepetitionPaySaveBO saveBO) {
        OrderRepetitionPayDTO dto = new OrderRepetitionPayDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    public Long addAndReturnId(OrderRepetitionPaySaveBO saveBO) {
        OrderRepetitionPayDTO dto = new OrderRepetitionPayDTO();
        BeanUtils.copyProperties(saveBO,dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        this.insert(dto);
        return id;
    }
}
